#include <stdio.h>
#include <stdlib.h>


struct Date {
    int year;
    int month;
    int date;
};


int main01()
{
    //printf("Hello world!\n");
    struct Date dd = {2012, 12, 12};
    printf("%d", dd.year);
    return 0;
}


int main02()
{
	int a = 100;
	int b = 100;
	int c = 200;
	printf("%p, %p\n", &a, &b);
	
	int *p = &a;
	int **p1 = &p;
	**p1 = 10;
	printf("%d\n", a);
	return 0;
}


int main03()
{
    int arr[3] = {1,2,3};
	int brr[2][3] = {{1,2,3},{4,5,6}};
	
	int *p;
	int (*p1)[3];
	
	// ===============================
	// ===============================
	
	// ok
	// p = arr; 
	// ok
	// printf("%d\n", p[0]); 
	
	// warning: assignment from incompatible pointer type [enabled by default]
	// p = brr; 
	
	// ===============================
	// ===============================
	
	// warning: assignment from incompatible pointer type [enabled by default]
	// p1 = arr; 
	
	// ok
	p1 = brr;
	// p1 + 1 就移动了 12 个字节 sizeof(int [3])。
	
	// p1[0] 就代表了第一个元素（数组）的地址
	// p1[0] 是一个变量，这个变量是一个数组，数组的名称代表了数组的首个元素的地址
	printf("%d\n", p1[0]);
	
	// p1[0][0] 结果是 1。
	printf("%d\n", p1[0][0]);
	
	int i = 0;
	int j = 0;
	for (i = 0; i < 2; i++) {
		for (j = 0; j < 3; j++) {
			printf("%d\n", p1[i][j]);
			printf("%d\n", *(*(p1 + i) + j));
		}
	}
	
	// ===============================
	// ===============================
	
    return 0;
}